import { RegisterPage } from '../root';
import { schema as BannerSchema } from './banner';
import { schema as MerchantSchema } from './merchant';
import {schema as GoodsListSchema} from "./goods/list";
import {schema as CreateSchema} from "./goods/create";
import {schema as EditSchema} from "./goods/edit";
import {schema as ViewSchema} from "./goods/view";
import {schema as OrderSchema} from "./order";
import OrderStatistic from "./statistic";
import {OrgSelector} from "../team";


RegisterPage({
    path: 'score_mall',
    label: '志愿回馈',
    icon: 'fa fa-map',
    acl: 'score_mall:list',
    children: [
        {
            path: 'banner',
            label: 'Banner设置',
            schema: BannerSchema,
            url: '/score_mall/banner',
            acl: 'score_mall:banner',
            NavComponent: OrgSelector,
            NavComponentTest: ({user}) => user.type == 4,
        },
        {
            path: 'merchant',
            label: '商户管理',
            schema: MerchantSchema,
            url: '/score_mall/merchant',
            acl: 'score_mall:merchant',
            NavComponent: OrgSelector,
            NavComponentTest: ({user}) => user.type == 4,
        },
        {
            path: "goods",
            label: "商品管理",
            acl: 'score_mall:list',
            children: [
                {
                    path: "list",
                    schema: GoodsListSchema,
                    label: "商品列表",
                    url: "/score_mall/goods/list",
                    NavComponent: OrgSelector,
                    NavComponentTest: ({user}) => user.type == 4,
                },
                {
                    path: "create",
                    schema: CreateSchema,
                    label: "新建商品",
                    url: "/score_mall/goods/create"
                },
                {
                    path: "/score_mall/goods/edit/:id",
                    schema: EditSchema,
                    label: "编辑商品",
                },
                {
                    path: "/score_mall/goods/view/:id",
                    schema: ViewSchema,
                    label: "查看商品",
                },
            ]
        },
        {
            path: 'order',
            label: '订单管理',
            schema: OrderSchema,
            url: '/score_mall/order',
            acl: 'score_mall:list',
            NavComponent: OrgSelector,
            NavComponentTest: ({user}) => user.type == 4,
        },
        {
            label: "数据统计",
            path: 'statistic',
            url: '/score_mall/statistic',
            component: OrderStatistic,
            acl: 'score_mall:list',
            NavComponent: OrgSelector,
            NavComponentTest: ({user}) => user.type == 4,
        },
    ]
});
